/**
 * @author Nicolas Lusa (lusan@usi.ch)
 */
package ch.usi.inf.pf2.gui;

import java.util.ArrayList;

import ch.usi.inf.pf2.circuit.Circuit;
import ch.usi.inf.pf2.circuit.Component;
import ch.usi.inf.pf2.circuit.Input;

public final class Model {

    private final Circuit circuit;
    private final Selection selection;
    
    
    public Model() {
        circuit = new Circuit();
        selection = new Selection();
    }
    
    public Model(final Circuit circuit) {
    	this.circuit = circuit;
    	selection = new Selection();
    }
    
    public Circuit getCircuit() {
        return circuit;
    }
    
    public Selection getSelection() {
        return selection;
    }
    
    public void clearSelection(){
    	selection.clear();
    }
    
    public int getSelectionSize() {
    	return selection.getSize();
    }
    
    public void shapeChanged() {
    	circuit.shapeChanged();
    }
    
    public ArrayList<Component> getShapes() {
    	return circuit.getShapes();
    }
    
    public ArrayList<Input> getInputs() {
    	return circuit.getInputs();
    }
    
    public void addSelectionListener(SelectionListener listener){
    	selection.addSelectionListener(listener);
    }
    
    public void addCircuitListener(CircuitListener listener){
    	circuit.addCircuitListener(listener);
    }
    
    public void addComponentListener(ComponentListener listener) {
    	circuit.addComponentListener(listener);
    }

}